None

object None : Option<Nothing>

Representation of a non-existent value.

Functions

all
Link copied to clipboard
common
inline fun all(predicate: (Nothing) -> Boolean): Boolean
Returns the result of applying the predicate to the value if this is Some or true if this is None.
any
Link copied to clipboard
common
inline fun any(predicate: (Nothing) -> Boolean): Boolean
Returns the result of applying the predicate to the value if this is Some or false if this is None.
asIterable
Link copied to clipboard
common
open override fun asIterable(): Iterable<Nothing>
Returns an iterable that wraps this Option returning its value if it is defined, or an empty iterable if the option is empty.
asSequence
Link copied to clipboard
common
open override fun asSequence(): Sequence<Nothing>
Returns a sequence that wraps this Option returning its value if it is defined, or an empty sequence if the option is empty.
filter
Link copied to clipboard
common
inline fun filter(predicate: (Nothing) -> Boolean): Option<Nothing>
Returns the same Some if the predicate is satisfied for the value.
filterIsInstance
Link copied to clipboard
common
inline fun <R> filterIsInstance(): Option<R>
Returns the same Some casted to type R if it is R.
filterNot
Link copied to clipboard
common
inline fun filterNot(predicate: (Nothing) -> Boolean): Option<Nothing>
Returns the same Some if the predicate is not satisfied for the value.
flatMap
Link copied to clipboard
common
inline fun <R> flatMap(transform: (Nothing) -> Option<R>): Option<R>
Maps value of a Some to a new Option using transform or returns the same None.
fold
Link copied to clipboard
common
inline fun <R> fold(default: R, transform: (Nothing) -> R): R
Returns result of applying transform on the value of Some or default if this is None.
inline fun <R> fold(default: () -> R, transform: (Nothing) -> R): R
Returns result of applying transform on the value of Some or default if this is None.
forEach
Link copied to clipboard
common
inline fun forEach(action: (Nothing) -> Unit)
Runs action if this is a Some.
get
Link copied to clipboard
common
open override fun get(): Nothing
Gets the value of a Some or throws an exception.
getOrNull
Link copied to clipboard
common
open override fun getOrNull(): Nothing?
Gets the value of a Some or null if this is a None.
iterator
Link copied to clipboard
common
open override fun iterator(): Iterator<Nothing>
Returns a singleton iterator returning the option's value if it is defined, or an empty iterator if the option is empty.
map
Link copied to clipboard
common
inline fun <R> map(transform: (Nothing) -> R): Option<R>
Maps value of a Some using transform or returns the same None.
none
Link copied to clipboard
common
inline fun none(predicate: (Nothing) -> Boolean): Boolean
Returns false if the predicate is met by the value if this is Some or true otherwise.
toLeft
Link copied to clipboard
common
inline fun <R> toLeft(right: () -> R): Either<Nothing, R>
Returns a Right containing the given argument right if this is empty, or a Left containing this option's value if it is defined.
toList
Link copied to clipboard
common
open override fun toList(): List<Nothing>
Returns a singleton list containing the option's value if it is defined, or an empty list if the option is empty.
toRight
Link copied to clipboard
common
inline fun <L> toRight(left: () -> L): Either<L, Nothing>
Returns a Left containing the given argument left if this is empty, or a Right containing this option's value if it is defined.
toString
Link copied to clipboard
common
open override fun toString(): String
zip
Link copied to clipboard
common
infix fun <R> zip(other: Option<R>): Option<Pair<Nothing, R>>
Returns Some containing a Pair of values of this and other if both Options are Some.
inline fun <T1, R> zip(other: Option<T1>, transform: (Nothing, T1) -> R): Option<R>
Returns Some containing the result of applying transform to both values of this and other if both Options are Some.

Properties

isDefined
Link copied to clipboard
common
val isDefined: Boolean
Returns true if the option is Some.
isEmpty
Link copied to clipboard
common
open override val isEmpty: Boolean = true
Returns true if the option is None.
isNotEmpty
Link copied to clipboard
common
val isNotEmpty: Boolean
Returns true if the option is Some.